package com.it.bigdata.util;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

public class Hbasetuils {
    private Hbasetuils(){}
    private static final Configuration conf= HBaseConfiguration.create();
    static {
        conf.set("hbase.zookeeper.quorum","node3:2181,node4:2181,node5:2181");
    }

    public static Connection getCon(){
        //使用工厂模型加载配置文件建立连接
        try {
            Connection con = ConnectionFactory.createConnection(conf);
            return con;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
